<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP '402.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <form>
  	请输入第一个数字:<input type="text" name="n1"><br>
  	请输入第二个数字:<input type="text" name="n2"><br>
  	<input type="submit" name="结果">
  </form>
  <%
  	String num1=request.getParameter("n1");
  	String num2=request.getParameter("n2");
  	String tip="";
  	if(num1!=null&&num2!=null){
  		int n1=Integer.parseInt(num1);
  		int n2=Integer.parseInt(num2);
  		if(n1>n2) tip="第一个数大";
  		else if(n1<n2) tip="第二个数大";
  		else tip="两个数相等";
  		pageContext.setAttribute("tip",tip);
  	}
  	else{
  		tip="输入不能为空！";
  	}  	
   %>
   结果：${tip }
  </body>
</html>
